import json
import csv

with open("./jobs.csv", "w") as out_file:
    csv_writer = csv.DictWriter(out_file, fieldnames=('job', 'company', 'address', 'salary'))
    with open("./jobs.txt", "r") as in_file:
        while True:
            line = in_file.readline()
            if not line:
                break

            info = json.loads(line)
            csv_writer.writerow(info)

            # out_file.write("[{}]\n".format(info['job'].strip()))
            # for key, value in info.items():
            #     if key != "job":
            #         out_file.write("{}={}\n".format(key, value))
